package io.gps.datatransfer.task;

import io.gps.datatransfer.CenterChannel;
import io.gps.datatransfer.task.taskentity.ConnectWork;
import io.gps.datatransfer.utils.SysDef;
import org.apache.log4j.Logger;


public class BatchConnectWork implements Runnable  {

    private static Logger logger = Logger.getLogger(BatchConnectWork.class);

    /**
     * 定时批量检查车辆与上级会话是否链接，并发送缓存的指令数据
     */
    @Override
    public void run() {
        try {
            if(!SysDef.sim_server_center.isEmpty()){
                for(CenterChannel centerChannel: SysDef.sim_server_center.values()) {
                    SysDef.executor.execute(new ConnectWork(centerChannel));
                }
            }
        } catch (Exception ie) {
            logger.error(ie.getMessage(),ie);
        }
    }
}